Import
Usage
Examples
- Basic Usage
- Multiple Assets
- Custom Fallback
Basic example of using the Media component to display an image:
Parameters
The component accepts the following props:Supported Media Types
The Media component automatically detects and handles different types of content:- Images: Renders standard image files (PNG, JPG, GIF, etc.)
- Videos: Supports video files with autoplay, loop, and controls
- 3D Models: Renders 3D models using ModelViewer component
- HTML: Displays HTML content in a sandboxed iframe
Features
Automatic Content Type Detection
The component automatically detects the content type of the asset and renders the appropriate element:Fallback Chain
If an asset fails to load, the component will:- Try the next asset in the assets array
- If all assets fail, display the custom fallback content
- If no fallback content is provided, show the default chess tile pattern
Loading States
The component includes built-in loading states:Notes
TheMedia component is designed to handle various types of collectible assets with built-in:
- Automatic content type detection
- Fallback handling
- Loading states
- Safari compatibility adjustments
- Videos autoplay by default
- Videos are muted by default for autoplay compatibility